
# 冒泡排序
# [8, 5, 2, 9, 6, 3] 从小到大排序

# [2, 3, 5, 6, 8, 9]
#              ^i 
#                 ^j
# i = 0
# j 1 -> 

def bubbleSort(array):

  for i in range(len(array) - 1):
    for j in range(i + 1, len(array)):

      if array[i] > array[j]:
        array[i], array[j] = array[j], array[i]

  return array

print(bubbleSort([8, 5, 2, 9, 6, 3]))
